﻿using SC.GridManage.Domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace SC.GirdManage.Repository
{
    /// <summary>
    /// 仓储接口 
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBaseRepository<T> where T:BaseEntity
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> CreateAsync(T entity);
        /// <summary>
        /// 更改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T entity);
        /// <summary>
        /// 根据id获取单个model
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        Task<T> GetModelAsync(long Id);
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        Task<IQueryable<T>> QueryAsync();

        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        Task<IQueryable<T>> QueryAsync(Expression<Func<T, bool>> expression);
    }
}
